package pers.warren.ai.oneapi.config;

import lombok.Getter;
import lombok.Setter;
import org.springframework.web.client.DefaultRestClientBuilder;
import org.springframework.web.client.RestClient.Builder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration(proxyBeanMethods = false)
public class OneApiConfiguration {

    @Getter
    @Setter
    @Value("${warren.ai.one-api.ip:'127.0.0.1'}")
    private String ip;

    @Getter
    @Setter
    @Value("${warren.ai.one-api.port:3000}")
    private String port;

    @Getter
    @Setter
    @Value("${warren.ai.one-api.username:root}")
    private String username;

    @Getter
    @Setter
    @Value("${warren.ai.one-api.password:'123456'}")
    private String password;

    @Setter
    @Value("${warren.ai.one-api.refresh.timeout:600000}")
    private String refreshTimeout;

    public Long getRefreshTimeout() {
        return Long.parseLong(refreshTimeout);
    }


    @Bean
    public Builder builder() {
        return new DefaultRestClientBuilder();
    }



}
